/**
* @author Ashish Gupta
* CVSSP, University of Surrey
* Copyright (c) 2010 Ashish Gupta
* All rights reserved.
*/
/**
 * 
 */
package genetic;

/**
 * @author Ashish
 *
 */
public class BhattacharyaMetric extends FitnessFunction {

	/* (non-Javadoc)
	 * @see genetic.FitnessFunction#calcFitness()
	 */
	@Override
	public Double calcFitness(Chromosome chromosome) {
		double fitness = 0.0;
		for(int i =0; i < chromosome.getVisualCodebook().getPositiveHistogram().length;i++){
			fitness += Math.sqrt(chromosome.getVisualCodebook().getPositiveHistogram()[i])*Math.sqrt(chromosome.getVisualCodebook().getNegativeHistogram()[i]);
		}
		return fitness;
	}

}
